<%--
  Created by IntelliJ IDEA.
  User: Chen
  Date: 2016/2/9
  Time: 22:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fns" uri="/WEB-INF/tlds/fns.tld" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>

<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<h2>
    ${empty topic.id?"添加题目":"查看题目"}
</h2>
<div class="error class alert-danger" style="display: none;padding:10px 0 8px 10px"></div>
<form id="topic-form"  class=" form-horizontal " role="form" style="padding-left: 20px">
    <div class="row">
        <div class="col-md-8">
            <input type="hidden" id="id" name="id" value="${topic.id}">

            <div class="form-group">
                <label for="name" class=" col-sm-2 control-label"><span class="text-fill">*</span> 题目：</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control input-sm required" title="请填写题目名称"  style="font-weight: 500;font-size: 18px; height: 42px;" id="name" name="name" value="${topic.name}">
                </div>
            </div>

            <div class="form-group">
                <label for="type" class="col-sm-2 control-label"><span class="text-fill">*</span>类型：</label>
                <div class="col-sm-4">
                    <c:forEach items="${fns:getDictList('topic_type')}" var="dict">
                        <input type="radio" id="radio${dict.id }"  class="required typeDisable"  id="type" name="type" ${topic.type==dict.value?"checked":""} value="${dict.value }" title="请选择题目类型"> ${dict.label }
                    </c:forEach>
                </div>
            </div>

            <div class="form-group">
                <label for="source" class="col-sm-2 control-label"><span class="text-fill">*</span>来源：</label>
                <div class="col-sm-9">
                    <c:forEach items="${fns:getDictList('topic_source')}" var="dict">
                        <input type="radio" id="radio${dict.id }" class="required sourceDisable" id="source" name="source" ${topic.source==dict.value?"checked":""} value="${dict.value }" title="请选择题目来源"> ${dict.label }
                    </c:forEach>
                </div>
            </div>

            <div class="form-group">
                <label for="restriction" class=" col-sm-2 control-label"><span class="text-fill">*</span>限制人数：</label>
                <div class="col-sm-4">
                    <input type="text" class="form-control input-sm required" title="请填写限制人数"  id="restriction" name="restriction" value="${topic.restriction}">
                </div>
            </div>

            <div class="form-group">
                <label for="description" class=" col-sm-2 control-label"><span class="text-fill">*</span>题目描述：</label>
                <div class="col-sm-10">
                    <textarea name="description" id="description" title="请填写题目描述"  rows="10px" class="form-control input-sm required"  >${topic.description}</textarea>
                </div>
            </div>

            <div class="form-group">
                <label for="creatorType" class=" col-sm-2 control-label"><span class="text-fill">*</span>出题人类型：</label>
                <div class="col-sm-4">
                    <c:forEach items="${fns:getDictList('creator_type')}" var="dict">
                        <input type="radio" id="radio${dict.id }" id="creatorType" class="required" name="creatorType" ${topic.creatorType==dict.value?"checked":""} value="${dict.value }" > ${dict.label }
                    </c:forEach>
                </div>
            </div>

            <div class="form-group">
                <label for="region-city-id" class=" col-sm-2 control-label"><span class="text-fill">*</span>出题人：</label>
                <input type="hidden" id="region-province-id" name="collegeProvince"  value="${topic.creator.office.id}">
                <input type="hidden" id="region-city-id" name="creator.id" value="${topic.creator.id}">
                <div class="col-sm-2"> <select id="region-province-select" class="span2 form-control required" ><option>专业</option></select></div>
                <div class="col-sm-2"> <select id="region-city-select" class="span2 form-control required" title="院校名称必须填写"><option>老师</option></select></div>
            </div>

            <div class="form-group">
                <label for="re-city-id" class=" col-sm-2 control-label"><span class="text-fill">*</span>指导老师：</label>
                    <input type="hidden" id="re-province-id" name="collegeProvince"  value="${topic.directTeacher.office.id}">
                    <input type="hidden" id="re-city-id" name="directTeacher.id" value="${topic.directTeacher.id}">
                    <div class="col-sm-2"> <select id="re-province-select" class="span2 form-control required" ><option>专业</option></select></div>
                    <div class="col-sm-2"> <select id="re-city-select" class="span2 form-control required" title="院校名称必须填写"><option>老师</option></select></div>
            </div>

            <div class="form-group">
                <label for="pass" class=" col-sm-2 control-label"><span class="text-fill">*</span>状态：</label>
                <div class="col-sm-10">
                    <c:forEach items="${fns:getDictList('topic_pass')}" var="dict">
                        <input type="radio" id="radio${dict.id }" id="pass" class="required sourceDisable" name="pass" ${topic.pass==dict.value?"checked":""} value="${dict.value }" > ${dict.label }
                    </c:forEach>
                </div>
            </div>


            <div  style="clear: both">
                <shiro:hasPermission name="sys:menu:edit">
                    <button id="topic-submit" class="btn btn-primary btn-sm" type="button">保 存</button>
                </shiro:hasPermission>
                <button id="topic-cancel" class="btn btn-sm" type="button" onclick="history.go(-1)">返 回</button>
            </div>
        </div>
    </div>
</form>


<script>
    <c:if test="${env == 'pro' }">
    requirejs(['${ctx}/assets/js/app/admin/topic-form-page.js']);
    </c:if>
    <c:if test="${env != 'pro' }">
    requirejs(['${ctx}/assets/js/app/admin/topic-form-page.js']);
    </c:if>

</script>